package csel.controller;

import java.util.Iterator;

import csel.controller.factories.ControllerBuilder;
import csel.controller.listeners.AbstractActionListener;
import csel.controller.listeners.KeyboardListener;
import csel.model.Model;
import csel.view.AreaViewport;
import csel.view.Splasher;
import csel.view.StatusViewport;

public class ControllerDriver
{
	public static void main(String args[])
	{
		// DUMMY OBJECTS!!!
		Model model = new ModelDummy();
		Splasher splashViewport = new Splasher( model );
		AreaViewport areaViewport = new AreaViewport( model );
		StatusViewport statusViewport = new StatusViewport( model );
		
		ControllerBuilder cb = new ControllerBuilder( 
				model, splashViewport, areaViewport, statusViewport );
		cb.contruct();
		
		Iterator<KeyboardListener> i = cb.getKList().iterator();
		while( i.hasNext() )
		{
			i.next().killWorker();
		}
		Iterator<AbstractActionListener> j = cb.getAList().iterator();
		while( j.hasNext() )
		{
			j.next().killWorker();
		}
		
		cb.getModelDispatcher().killWorker();
		cb.getViewDispatcher().killWorker();
	}
}
